﻿/* EntitiesToDTOs. Copyright (c) 2011. Fabian Fernandez.
 * http://entitiestodtos.codeplex.com
 * Licensed by Common Development and Distribution License (CDDL).
 * http://entitiestodtos.codeplex.com/license
 * Fabian Fernandez. 
 * http://www.linkedin.com/in/fabianfernandezb/en
 * */
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace EntitiesToDTOs.Enums
{
    /// <summary>
    /// Represents an Enum. Used to overcome conversion of values when parsed to string. 
    /// e.g.: when used in configuration management.
    /// </summary>
    internal abstract class FakeEnum
    {
        /// <summary>
        /// Checks if the provided value is valid for the current fake enum class. 
        /// Must be implemented (using new keyword) in child classes.
        /// </summary>
        /// <param name="value">Value to validate.</param>
        public static void Validate(string value)
        {
            throw new NotImplementedException();
        }
    }

    /// <summary>
    /// Provides the types of Source File Generation. 
    /// </summary>
    internal class SourceFileGenerationTypeEnum : FakeEnum
    {
        /// <summary>
        /// Indicates to generate one Source File per Class.
        /// </summary>
        public static readonly string SourceFilePerClass = "SourceFilePerClass";
        
        /// <summary>
        /// Indicates to generate only one Source File.
        /// </summary>
        public static readonly string OneSourceFile = "OneSourceFile";

        /// <summary>
        /// Checks if the provided value is valid for the current fake enum class.
        /// </summary>
        /// <param name="value">Value to validate.</param>
        public static new void Validate(string value)
        {
            if (value != SourceFileGenerationTypeEnum.SourceFilePerClass
                && value != SourceFileGenerationTypeEnum.OneSourceFile)
            {
                throw new ArgumentException();
            }
        }
    }

    /// <summary>
    /// Provides the types of Associations between DTOs.
    /// </summary>
    internal class AssociationTypeEnum : FakeEnum
    {
        /// <summary>
        /// Associate by Entity Key Property.
        /// </summary>
        public static readonly string KeyProperty = "KeyProperty";

        /// <summary>
        /// Associate by Entity Class Type.
        /// </summary>
        public static readonly string ClassType = "ClassType";

        /// <summary>
        /// Checks if the provided value is valid for the current fake enum class.
        /// </summary>
        /// <param name="value">Value to validate.</param>
        public static new void Validate(string value)
        {
            if (value != AssociationTypeEnum.KeyProperty
                && value != AssociationTypeEnum.ClassType)
            {
                throw new ArgumentException();
            }
        }
    }

    /// <summary>
    /// Provides the types of Association Multiplicity.
    /// </summary>
    internal enum EntityAssociationMultiplicityEnum
    {
        /// <summary>
        /// Zero or One
        /// </summary>
        ZeroOrOne,

        /// <summary>
        /// One
        /// </summary>
        One,

        /// <summary>
        /// Many
        /// </summary>
        Many
    }

    /// <summary>
    /// Provides the types of Association End desired.
    /// </summary>
    internal enum EntityAssociationEndEnum
    {
        /// <summary>
        /// Get the First Association End.
        /// </summary>
        First,

        /// <summary>
        /// Get the Second Association End.
        /// </summary>
        Second
    }
}